{extend name="public:layout" /}
{block name="title"}
申请圈子
{/block}
{block name="head"}
<link rel="stylesheet" href="/public/plugins/dropload/dropload.css">
<style>
    .weui-cell__bd{font-size:14px;color:#333;}
</style>
{/block}
{block name="body"}
<div class="mcm-head">
    <div class="head-left">
        <a href="javascript:history.back(-1)" class="link">
            <span class="iconfont icon-zuoyou1"></span>
        </a>
    </div>
    <div class="head-title">
        申请加入圈子
    </div>
</div>
<div style="height:50px;"></div>
<div class="enroll-box" style="padding:10px;">
        <form method="post" class="form-horizontal" id="form">
        <div class="weui-cells weui-cells_form">
            <div class="weui-cell">
                <div class="weui-cell__hd"><label class="weui-label">圈子名称</label></div>
                <div class="weui-cell__bd">
                    {$circle_info.circle_name}
                    <input type="hidden" name="circle_id" value="{$circle_info.circle_id}">
                </div>
            </div>
            <div class="weui-cell">
                <div class="weui-cell__hd">
                    <label class="weui-label">申请理由</label>
                </div>
                <div class="weui-cell__bd">
                    <textarea class="weui-textarea" placeholder="请输入申请理由" id="msg" rows="3">{$circle_member_info.cm_applycontent}</textarea>
                </div>
            </div>
            {eq name="circle_member_info.cm_state" value="2"}
            <div class="weui-cells__tips">您的上次申请已经驳回，请修改申请理由重新申请</div>
            {/eq}
        </div>
        <div class="weui_btn_area" style="padding:20px 0;">
            <div id="validError"></div>
            <button class="weui-btn weui-btn_primary" type="button" style="background:#f60" onclick="sendApply()">
                {eq name="circle_member_info.cm_state" value="2"}
                重新申请
                {else}
                申请
                {/eq}
            </button>
        </div>
    </form>
</div>
{/block}
{block name="js"}
<script>
    function sendApply() {
        var circle_id='{$circle_info.circle_id}';
        var cm_applycontent=$('#msg').val();
        $.post('{:url("circleApply")}',{circle_id:circle_id,cm_applycontent:cm_applycontent},function (res) {
            layer.open({
                content: res.msg
                ,skin: 'msg'
                ,time: 2 //2秒后自动关闭
            });
            if (res.code){
                location.href="{:url('/circle/Theme/index')}"
            }
        })
    }
</script>
{/block}